package com.example.controller;

import com.example.entity.Inline;
import com.example.mapper.InlineMapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.time.LocalDateTime;

@RestController
@RequestMapping("/user")
public class InlineController {

    @Resource
    private InlineMapper userMapper;

    @GetMapping("/save/{age}")
    public String insert(@PathVariable("age")Integer age) {
        Inline inline = new Inline();
        inline.setNickname(LocalDateTime.now().toString());
        inline.setPassword("123456");
        inline.setSex(1);
        inline.setAge(age);
        inline.setBirthday("1990-10-01");
        userMapper.addUser(inline);
        return "success";
    }


}
